import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28779
 * Date: 2024-02-21
 * Time: 9:57
 */
@WebServlet("/hello")
public class HelloServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

        //是在服务器日志中产生的 （tomcat）
        System.out.println("Hello World");

        //想要把hello world 返回给客户端，还需要进一步的使用下列代码。
        resp.getWriter().write("hello world");
    }
}
